<?php
/*
 * article class
 */
namespace lightblog\home\controller;

use lightblog\engine\controller;
use lightblog\home\model\aboutModel;

class about extends controller {
    function indexAction() {
        return $this->render(array('he' => 'not me'));
    }

    function contactAction() {
        if (\lightblog::$app->request->method == 'POST') {
            return $this->newContactMessage();
        }
        return $this->render();
    }

    private function newContactMessage() {
        $model = new aboutModel;

        if ($model->addContactMessage()) {
            $this->success('留言成功', route('index', 'index'));
        } else {
            $this->error('出现错误, 稍后再试');
        }
    }
}
